package com.qf;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

class MyRunnable implements Runnable{

    public void run() {
        System.out.println(Thread.currentThread().getName()+"：通过Callable接口来实现多线程");
    }
}

public class ThreadPool {

    private static int threadPoolNum=8;

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        for (int i=0;i<threadPoolNum;i++){
            MyRunnable thread = new MyRunnable();
            executorService.execute(thread);
        }
        executorService.shutdown();
    }
}
